package com.designPatterns.proxy;

/**
 * 构造函数中增加了接口实例参数
 * Created by houjinxin on 16/3/29.
 */
public class Target2 implements ITarget2 {

    Target2(ITarget2 proxy){
        if (!proxy.getClass().getSimpleName().contains("Proxy")){
            throw new RuntimeException("不是代理类不可以创建对象");
        }
    }

    @Override
    public void say(String word) {
        System.out.println(word);
    }
}
